package Newsblog;
//12.16牛客小白月赛
import java.util.Scanner;

/**
 * @author :chenjie
 * @date :Created 2022/12/16 19:30
 */
public class SorcererMorningEmbrace {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int[]arr=new int[n];
        for (int i = 0; i < n; i++) {
            arr[i]=sc.nextInt();
        }
        int x=2,sum=0;
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                int s=arr[j]-x;
                if(s==0){
                    arr[j]=0;
                    x++;
                }
                if(s<0){
                    arr[j]=0;
                }
                if(s>0){
                    arr[j]=s;
                }
            }
            sum=sum+x;
        }
        System.out.println(sum);
    }

}
